home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Business Heaven
/
Business Heaven.iso
/
network.w
/
rfdml112
/
unix.scr
< prev
next >
Wrap
Text File
|
1993-11-14
|
19KB
|
708 lines
;------------------------------------------------------
;
;UNIX.SCR --- The script file for UNIX (world.std.com)
;
;------------------------------------------------------
;
; We begin with the format specifiers to which allow
;the script to identify where the MailId, RealName,
;and Subject texts are in a newly downloaded letter.
;
Format
Subject: $SUBJECT$\n
Subj: $SUBJECT$\n
From: "$NAME$" <$UID$>\n
From: ""$NAME$"" <$UID$>\n
From: $NAME$<$UID$>\n
From: $UID$ ($NAME$)\n
From: $UID$ \n
From: $UID$\n
Endformat
;------------------------------------------------------
;
; Next is a set of aliases which determine various
; items such as where some of the standard commands
; like '/usr/ucb/mail' live.
;
Alias sendmail '/usr/ucb/mail '
Alias readmail '/usr/ucb/mail'
Alias saveletter 's '
Alias deleteletter 'd '
Alias quitmail 'q'
Alias mailnull '#'
Alias mailshellesc '!'
Alias rm '/bin/rm -f '
Alias echo '/bin/echo '
Alias cat '/bin/cat '
Alias logoff 'exit'
;------------------------------------------------------
;
; The following aliases determine the various prompts the
; script will look for. The most important one is the
; 'prompt' alias, which will need to be adjusted to match
; the prompt that your UNIX host gives.
;
Alias prompt '\nworld%'
Alias mailprompt '\n& '
Alias subjectprompt '\nSubject: '
Alias ccprompt1 'Cc:'
Alias ccprompt2 'CC:'
Alias ccprompt3 'cc:'
Alias loginprompt '\nlogin: '
Alias passwdprompt '\nPassword:'
Alias havemailprompt 'message'
Alias nomailprompt 'No mail'
;
; If you want to append your ~/.signature file to every outgoing
; message, set the following alias to SEND_SIG, otherwise set it
; to NO_SIGNATURE:
;
Alias signature NO_SIGNATURE
;
;------------------------------------------------------
;
; The following aliases determine what the script will look
; for to determine that we've successfully logged in
; (banner1-3), and what it will look for to determine that
; we've successfully logged out (logoffbanner1-2)
;
Alias banner1 'Public Access Unix'
Alias banner2 'New World'
Alias banner3 '\nLast login:'
Alias logoffbanner1 %loginprompt%
Alias logoffbanner2 'closed'
;------------------------------------------------------
;
; The following alias determines what intermediate network
; will be assumed. It can be one of the following:
;
; DIRECT Direct connection to the host (default)
; DIRLAT Direct connection to a LAT
; CIS Connect through CIS Packet Net
;
Alias connectype DIRECT
;
; The following alias should be set TRUE if your modem
; drops carrier every time you make a connection. This
; alias simply forces the script to wait 2 seconds for
; the connection to settle before starting the script.
;
Alias waitasec FALSE
;
;------------------------------------------------------
;
; The following aliases define the connection and password
; keywords to specify for CIS Packet Net. They are currently
; set to connect to world.std.com, and need to be changed
; for any other UNIX site.
;
Alias cisconnect 'world,domestic'
Alias cispasswd 'notobvious'
Alias cisconnprompt 'Connected to world.std.com'
;
;------------------------------------------------------
;
; Set the following aliases to reflect your LAT's prompt if you
; are connecting through a LAT:
;
Alias latprompt1 'local>'
Alias latprompt2 'Local>'
;
; Set the following alias to be the command which connects your LAT
; to the host
;
Alias hostconnect 'open hostname'
;
;------------------------------------------------------
;
; The following aliases determine the command to use for
; downloading, and the prompt the upload program will send
; when it's ready to send data. Comment these out if
; you don't want to use ZMODEM:
;
Alias sz 'sz '
Alias szprompt1 '\nsz: 1 file'
Alias dnloadproto ZMODEM
;
; Uncomment the following aliases if you want to use YMODEM
; as your download protocol:
;
;Alias sz 'sb '
;Alias szprompt1 '\nsb: 1 file'
;Alias dnloadproto YMODEM
;
; Uncomment the following aliases if you want to use XMODEM
; as your download protocol:
;
;Alias sz 'sx '
;Alias szprompt1 'command now.'
;Alias dnloadproto XMODEM
;
;------------------------------------------------------
;
; The following aliases determine the command to use for
; uploading, and the prompt the upload program will send
; when it's ready to receive data. Comment these out if
; you don't want to use ZMODEM:
;
Alias rz 'rz -a '
Alias rzprompt1 'to your modem'
Alias rzprompt2 'ready'
Alias uploadproto ZMODEM
;
; Uncomment the following aliases if you want to use YMODEM
; as your upload protocol:
;
;Alias rz 'rb -a '
;Alias rzprompt1 'to your modem'
;Alias rzprompt2 'ready'
;Alias uploadproto YMODEM
;
; Uncomment the following aliases if you want to use XMODEM
; as your upload protocol:
;
;Alias rz 'rx -ac '
;Alias rzprompt1 'to your modem'
;Alias rzprompt2 'ready to receive'
;Alias uploadproto XMODEM
;
; Uncomment the following aliases if you want to use KERMIT
; as your upload protocol:
; (note that you *must* use kermit on CIS Packet Net)
;
;Alias rz 'kermit -e 256 -r '
;Alias rzprompt1 'READY TO RECEIVE'
;Alias rzprompt2 'ready to receive'
;Alias uploadproto KERMIT
;
;------------------------------------------------------
; This is the main entry-point for the script, which
; decides which intermediate network will be used to
; connect to the host.
;
Begin START
If %waitasec% Then WAIT_START
If TRUE Then %connectype%
End
Begin WAIT_START
Timeout 2 Goto %connectype%
End
;------------------------------------------------------
; This is the entry-point for direct-connection to the
; host. This state merely sends CR's every three
; seconds until it sees a login prompt.
;
Begin DIRECT
Caption 'connected'
Cr
When %loginprompt% Goto USERNAME
Timeout 3 Goto START
End
;------------------------------------------------------
; This is the entry-point for the CIS Packet Net connection
; to the host. It merely answers the Host Name and Password
; prompts for the desired host. Don't worry about the
; seemingly 'garbaged' When statements. They are that way
; to account for an 8n1 connection to a CIS node which
; insists on talking 7e1.
;
Begin CIS
Caption 'connected'
Cr
When '\nHost Name:' Goto CISHOSTNAME
When 'Ho≤táNßφe:' Goto CISHOSTNAME
Timeout 3 Goto CIS
End
Begin CISHOSTNAME
Transmit %cisconnect%
Cr
When '\nHost Name:' Goto CISHOSTNAME
When 'Ho≤táNßφe:' Goto CISHOSTNAME
When '\nPassword:' Goto CISHOSTPASSWORD
When 'Pß≤≤worΣ:' Goto CISHOSTPASSWORD
Timeout 30 Goto GIVE_UP
End
Begin CISHOSTPASSWORD
Transmit %cispasswd%
Cr
When '\nHost Name:' Goto CISHOSTNAME
When 'Ho≤táNßφe:' Goto CISHOSTNAME
When '\nPassword:' Goto CISHOSTPASSWORD
When 'Pß≤≤worΣ:' Goto CISHOSTPASSWORD
When %cisconnprompt% Goto CONNECTHOST
When %loginprompt% Goto USERNAME
Timeout 30 Goto GIVE_UP
End
Begin CONNECTHOST
Caption 'logging in'
When %loginprompt% Goto USERNAME
Timeout 30 Goto GIVE_UP
End
;------------------------------------------------------
; These two states handle connecting to the host
; once we're directly connected to the LAT
;
Begin DIRLAT
Caption 'connected'
Cr
When %latprompt1% Goto LOCAL_PROMPT
When %latprompt2% Goto LOCAL_PROMPT
Timeout 3 Goto START
End
Begin LOCAL_PROMPT
Transmit %hostconnect%
Cr
When %latprompt1% Goto LOCAL_PROMPT
When %latprompt2% Goto LOCAL_PROMPT
When %loginprompt% Goto USERNAME
Timeout 30 Goto GIVE_UP
End
;------------------------------------------------------
; At this point we've seen the host's login prompt, and
; are attempting to log in.
;
Begin USERNAME
Transmit $USERNAME
Cr
When %passwdprompt% Goto PASSWORD
When %loginprompt% Goto USERNAME
Timeout 120 Goto NO_LOGIN
End
Begin PASSWORD
Transmit $PASSWORD
Cr
When %passwdprompt% Goto PASSWORD
When %loginprompt% Goto USERNAME
When %banner1% Goto LOGGED_IN
When %banner2% Goto LOGGED_IN
When %banner3% Goto LOGGED_IN
When %prompt% Goto JUMP_TO_MAIL
Timeout 120 Goto NO_LOGIN
End
Begin LOGGED_IN
Caption 'logged in'
When 'TERM = ' Goto SEND_TERMTYPE
When %prompt% Goto JUMP_TO_MAIL
When 'More? [ynq]' Goto ANNOUNCEMENTS
Timeout 120 Goto NO_LOGIN
End
;------------------------------------------------------
; If your login procedure asks for a termtype, this
; state merely sets it to a vanilla 'ansi' terminal.
;
Begin SEND_TERMTYPE
Transmit 'ansi'
Cr
When %prompt% Goto JUMP_TO_MAIL
When 'More? [ynq]' Goto ANNOUNCEMENTS
Timeout 45 Goto NO_LOGIN
End
;------------------------------------------------------
; These states are specific to world.std.com, which
; has "announcements" at login. If there are any
; pending, they are downloaded to the PC, fooling
; RFD Mail into thinking they are a mail message from
; 'World Announcements'.
;
Begin ANNOUNCEMENTS
Caption 'Announcements'
Transmit 's msgs.tmp'
Cr
When '\nMore? [ynq]' Goto NEXT_ANNOUNCEMENT
When '--More--' Goto SCROLL
When %prompt% Goto BUILD_ANNOUNCEMSG
Timeout 45 Goto NO_LOGIN
End
Begin NEXT_ANNOUNCEMENT
Transmit 'n'
Cr
When '\nMore? [ynq]' Goto ANNOUNCEMENTS
When '--More--' Goto SCROLL
When %prompt% Goto BUILD_ANNOUNCEMSG
Timeout 45 Goto NO_LOGIN
End
Begin BUILD_ANNOUNCEMSG
Transmit %echo%
Transmit '"From: announce (World Announcements)" > '
Transmit $LETTER.FILENAME
Cr
When %prompt% Goto CAT_ANNOUNCEMENT
Timeout 45 Goto CAT_ANNOUNCEMENT
End
Begin CAT_ANNOUNCEMENT
Transmit %cat%
Transmit '< msgs.tmp >> '
Transmit $LETTER.FILENAME
Cr
When ' such file ' Goto NO_ANNOUNCEMENT
When %prompt% Goto DNLOAD_ANNOUNCEMENT
Timeout 45 Goto NO_LOGIN
End
Begin DNLOAD_ANNOUNCEMENT
Transmit %sz%
Transmit $LETTER.FILENAME
Cr
When %szprompt1% Goto DO_ANNDNLOAD
When %prompt% Goto NO_ANNOUNCEMENT
Timeout 45 Goto NO_LOGIN
End
Begin DO_ANNDNLOAD
Download %dnloadproto% Then ANNDNLD_SUCCESS Else NO_LOGIN
End
Begin ANNDNLD_SUCCESS
Confirm LETTER.RECEIVED Successful
Caption 'Announcements Received'
When %prompt% Goto NO_ANNOUNCEMENT
Timeout 5 Goto END_ANNDNLOAD
End
Begin END_ANNDNLOAD
Cr
When %prompt% Goto NO_ANNOUNCEMENT
Timeout 5 Goto END_ANNDNLOAD2
End
Begin END_ANNDNLOAD2
Control C
When %prompt% Goto NO_ANNOUNCEMENT
Timeout 5 Goto GIVE_UP
End
Begin NO_ANNOUNCEMENT
Transmit %rm%
Transmit 'msgs.tmp '
Transmit $LETTER.FILENAME
Cr
When %prompt% Goto JUMP_TO_MAIL
Timeout 45 Goto JUMP_TO_MAIL
End
Begin SCROLL
Transmit ' '
When '\nMore? [ynq]' Goto ANNOUNCEMENTS
When '--More--' Goto SCROLL
When %prompt% Goto BUILD_ANNOUNCEMSG
Timeout 30 Goto NO_LOGIN
End
;------------------------------------------------------
; These states check to see if there is any mail waiting
; by running the host's mail program and looking for
; keywords indicating the presence/absence of mail.
; If there's mail (and the script is in fetch mode),
; then the FETCH_FROM_MAIN_MENU sequence is started.
; If there's no mail, but there are letters to send,
; the SEND_MAIL sequence is started. Otherwise the
; script just logs off.
;
Begin JUMP_TO_MAIL
Transmit %readmail%
Cr
When %nomailprompt% Goto NO_MAIL_WAITING
When %havemailprompt% Goto MAIL_WAITING
Timeout 10 Goto RETRY_JUMP
End
Begin RETRY_JUMP
Transmit %readmail%
Cr
When %nomailprompt% Goto NO_MAIL_WAITING
When %havemailprompt% Goto MAIL_WAITING
Timeout 15 Goto GIVE_UP
End
Begin NO_MAIL_WAITING
Caption 'No Mail'
If MORE_LETTERS Then SEND_MAIL
When %prompt% Goto LOG_OFF
Timeout 15 Goto GIVE_UP
End
Begin MAIL_WAITING
Caption 'You Have Mail'
If FETCHING Then FETCH_FROM_MAIN_MENU
If MORE_LETTERS Then SEND_BUT_QUIT
When %mailprompt% Goto QUIT_MAIL
Timeout 120 Goto LOG_OFF
End
Begin QUIT_MAIL
Transmit %quitmail%
Cr
When %mailprompt% Goto QUIT_MAIL
When %prompt% Goto LOG_OFF
Timeout 15 Goto GIVE_UP
End
Begin SEND_BUT_QUIT
Transmit %quitmail%
Cr
When %mailprompt% Goto SEND_BUT_QUIT
When %prompt% Goto REQUEST_UPLOAD_LETTER
Timeout 15 Goto GIVE_UP
End
;------------------------------------------------------
; These states execute for each letter to be downloaded.
; They save the letter to the mail.tmp file, download
; the file, instruct RFD to put the letter in the In Box,
; delete the letter on the host, then check for more mail.
;
Begin FETCH_FROM_MAIN_MENU
When %mailprompt% Goto PRESERVE_MAIL
Timeout 10 Goto PRESERVE_MAIL
End
Begin PRESERVE_MAIL
Transmit 'preserve *'
Cr
ClearIndex
When %mailprompt% Goto DEL_TMPFILE
Timeout 20 Goto DEL_TMPFILE
End
Begin DEL_TMPFILE
Transmit %mailshellesc%
Transmit %rm%
Transmit $LETTER.FILENAME
Cr
NextIndex
When %mailprompt% Goto SAVE_CURLETTER
Timeout 20 Goto SAVE_CURLETTER
End
Begin SAVE_CURLETTER
Transmit %saveletter%
Transmit $INDEX
Transmit ' '
Transmit $LETTER.FILENAME
Cr
When 'New file' Goto REQUEST_DOWNLOAD
When 'No messages' Goto NO_MORE_MAIL
When 'Invalid message' Goto NO_MORE_MAIL
Timeout 10 Goto REQUEST_DOWNLOAD
End
Begin REQUEST_DOWNLOAD
Caption 'Fetching Mail'
Transmit %mailshellesc%
Transmit %sz%
Transmit $LETTER.FILENAME
Cr
When %szprompt1% Goto DOWNLD_LETTER
Timeout 20 Goto ABORT_DOWNLD
End
Begin ABORT_DOWNLD
Control X
Control X
Control X
Control X
Control X
Control X
Control X
Control C
When %prompt% Goto JUMP_TO_MAIL
When %mailprompt% Goto REQUEST_DOWNLOAD
Timeout 20 Goto JUMP_TO_MAIL
End
Begin PAUSE_FOR_DOWNLD
Timeout 1 Goto DOWNLD_LETTER
End
Begin DOWNLD_LETTER
Download %dnloadproto% Then DOWNLD_SUCCESS Else RETRY_DNLOAD
End
Begin RETRY_DNLOAD
Caption 'Retrying Download'
Transmit %mailnull%
Cr
When %mailprompt% Goto RETRY_REQDNLOAD
Timeout 5 Goto RETRY_REQDNLOAD
End
Begin RETRY_REQDNLOAD
Transmit %mailshellesc%
Transmit %sz%
Transmit $LETTER.FILENAME
Cr
When %szprompt1% Goto RETRY_DOWNLD_LETTER
Timeout 20 Goto ABORT_DOWNLD
End
Begin RETRY_DOWNLD_LETTER
Download %dnloadproto% Then DOWNLD_SUCCESS Else GIVE_UP
End
Begin DOWNLD_SUCCESS
Confirm LETTER.RECEIVED Successful
Caption 'Letter Received'
Transmit %mailnull%
Cr
When %mailprompt% Goto DELETE_LETTER
Timeout 5 Goto SEND_DOWNLD_CR
End
Begin SEND_DOWNLD_CR
Transmit %mailnull%
Cr
When %mailprompt% Goto DELETE_LETTER
Timeout 5 Goto SEND_DOWNLD_CR
End
Begin DELETE_LETTER
Caption 'Deleting Letter'
Transmit %deleteletter%
Transmit ' '
Transmit $INDEX
Cr
When %mailprompt% Goto DEL_TMPFILE
Timeout 10 Goto DEL_TMPFILE
End
Begin NO_MORE_MAIL
Caption 'Fetched Mail'
When %mailprompt% Goto END_FETCH
Timeout 10 Goto END_FETCH
End
Begin END_FETCH
Transmit %quitmail%
Cr
If MORE_LETTERS Then SEND_MAIL
When %mailprompt% Goto END_FETCH
When %prompt% Goto LOG_OFF
Timeout 10 Goto LOG_OFF
End
;------------------------------------------------------
; These states execute for each letter to send. First
; the letter is uploaded into the mail.tmp file, then
; the host's mail program is run, giving it the address,
; then the subject, body, and CC information.
;
Begin SEND_MAIL
When %prompt% Goto DEL_UPFILE
Timeout 15 Goto DEL_UPFILE
End
Begin DEL_UPFILE
Transmit %rm%
Transmit $LETTER.FILENAME
Cr
When %prompt% Goto REQUEST_UPLOAD_LETTER
Timeout 30 Goto GIVE_UP
End
Begin REQUEST_UPLOAD_LETTER
Transmit %rz%
Cr
When %rzprompt1% Goto BEGIN_LETTER_UPLOAD
When %rzprompt2% Goto BEGIN_LETTER_UPLOAD
Timeout 20 Goto GIVE_UP
End
Begin WAIT_FOR_UPLOAD
Timeout 1 Goto BEGIN_LETTER_UPLOAD
End
Begin BEGIN_LETTER_UPLOAD
NewLetter
Upload %uploadproto% Then UPLOAD_SUCCESS Else GIVE_UP
End
Begin UPLOAD_SUCCESS
Caption 'Letter Uploaded'
Cr
When %prompt% Goto SEND_LETTER
Timeout 5 Goto END_LETTER_UPLOAD
End
Begin END_LETTER_UPLOAD
Cr
When %prompt% Goto SEND_LETTER
Timeout 5 Goto END_LETTER_UPLOAD2
End
Begin END_LETTER_UPLOAD2
Control C
When %prompt% Goto SEND_LETTER
Timeout 5 Goto GIVE_UP
End
Begin SEND_LETTER
Transmit %sendmail%
Transmit $LETTER.DEST.USERNAME
Cr
When %subjectprompt% Goto SEND_SUBJECT
When 'not found' Goto RETRY_SEND_LETTER
Timeout 15 Goto GIVE_UP
End
Begin RETRY_SEND_LETTER
Transmit %sendmail%
Transmit $LETTER.DEST.USERNAME
Cr
When %subjectprompt% Goto SEND_SUBJECT
When 'not found' Goto GIVE_UP
Timeout 15 Goto GIVE_UP
End
Begin SEND_SUBJECT
Transmit $LETTER.SUBJECT
Cr
Timeout 2 Goto SEND_BODY
End
Begin SEND_BODY
Transmit '~r '
Transmit $LETTER.FILENAME
Cr
Timeout 1 Goto %signature%
End
Begin SEND_SIG
Transmit '~r .signature'
Cr
Timeout 1 Goto NO_SIGNATURE
End
Begin SEND_CC
Transmit '~c '
CreateCC 0 80 Delimiter ','
Transmit $LETTER.CC
Cr
Timeout 1 Goto NO_SIGNATURE
End
Begin NO_SIGNATURE
If LETTER.CC Then SEND_CC
Control D
When %prompt% Goto LETTER_SENT
When %ccprompt1% Goto SEND_CC_CR
When %ccprompt2% Goto SEND_CC_CR
When %ccprompt3% Goto SEND_CC_CR
Timeout 5 Goto NO_SIGNATURE
End
Begin SEND_CC_CR
Cr
When %prompt% Goto LETTER_SENT
When %ccprompt1% Goto SEND_CC_CR
When %ccprompt2% Goto SEND_CC_CR
When %ccprompt3% Goto SEND_CC_CR
Timeout 10 Goto SEND_CC_CR
End
Begin LETTER_SENT
Caption 'Letter Sent'
Confirm LETTER.SENT Successful
Transmit %rm%
Transmit $LETTER.FILENAME
Cr
When %prompt% Goto SEND_MORE_MAIL
Timeout 15 Goto GIVE_UP
End
Begin SEND_MORE_MAIL
If MORE_LETTERS Then REQUEST_UPLOAD_LETTER
If TRUE Then LOG_OFF
End
;------------------------------------------------------
; These states deal with logging off the system
;
Begin WAIT_TO_LOG_OFF
When %prompt% Goto LOG_OFF
Timeout 20 Goto GIVE_UP
End
Begin LOG_OFF
Transmit %logoff%
Cr
Caption 'Logging off'
When 'NO CAR' Goto EXIT_PROGRAM
When %logoffbanner1% Goto HANGUP_PHONE
When %logoffbanner2% Goto HANGUP_PHONE
When %prompt% Goto LOG_OFF
CarrierLoss Goto EXIT_PROGRAM
Timeout 20 Goto GIVE_UP
End
Begin EXIT_PROGRAM
Caption 'Logged off'
CarrierLoss Goto EXIT_PROGRAM
Timeout 3 Goto BYE_BYE
End
Begin GIVE_UP
Caption 'Aborting'
Hangup
CarrierLoss Goto EXIT_PROGRAM
End
Begin HANGUP_PHONE
Hangup
CarrierLoss Goto EXIT_PROGRAM
End
Begin NO_LOGIN
Timeout 5 Goto GIVE_UP
End
Begin BYE_BYE
Exit
End